window.onload = function () {
	let phone = sessionStorage.getItem('phone')
	let name = sessionStorage.getItem('name')
	if (phone != null && name != null) {
		console.log(123)
		let url = `http://newshopapi.0melon0.cn/api/f_user/report`
		let data = {
			phone: phone,
			name: name,
		}
		fetch(url, {
			method: 'POST',
			headers: {
				'Content-Type': 'application/json',
			},
			body: JSON.stringify(data),
		})
			.then(function (response) {
				return response.json()
			})
			.then(function (data) {
				let arr = data.result[data.result.length - 1]
				console.log(arr)
				let nameHead = document.querySelector('.name')
				let timeHead = document.querySelector('.time')
				let bottomTime = document.querySelector('.bottomTime')
				nameHead.innerHTML = name
				timeHead.innerHTML = arr.day_time
				bottomTime.innerHTML = arr.show_id
			})
	} else {
		alert('查询失败')
		location.href = '../index.html'
	}
}
